<?php

namespace App\Models\OpenShop\InvestmentPromotion;

use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Relations\HasOne;

class OpenShopUserExtContractModel extends BaseModel
{
    protected $table = 'open_shop_user_ext_contract';

    /**
     * @return HasOne
     */
    public function userContractRel(): HasOne
    {
        return $this->hasOne(OpenShopUserContractModel::class, 'id', 'contractId');
    }

    public static function updateByContractId($id, $status)
    {
        self::query()
            ->where('contractId', $id)
            ->update(['signStatus' => $status, 'signTime' => time()]);
    }
}
